package com.scedu.convert;

import com.scedu.domain.OrderDetail;
import com.scedu.dto.CartDTO;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

public class OrderDetail2CartDTOConverter {
    public static CartDTO convert(OrderDetail orderDetail){
        CartDTO cartDTO= new CartDTO (orderDetail.getProductId(),orderDetail.getProductQuantity());
       return  cartDTO;

   }
   public  static List<CartDTO> convert(List<OrderDetail> orderDetailList){
       List<CartDTO> cartDTOList=orderDetailList.stream().map(e->
               convert(e)
        ).collect(Collectors.toList());
        return cartDTOList;
    }
}
